package org.lin.shortlink.core;

public class ApiResponse {
    /*状态码*/
    private int code;

    private String msg;

    private Object data;

    public ApiResponse(int code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static ApiResponse response(ResponseEnums responseEnums, Object data) {
        return new ApiResponse(responseEnums.getCode(), responseEnums.getMessage(),data);
    }
    public static ApiResponse response(ResponseEnums responseEnums) {
        return new ApiResponse(responseEnums.getCode(), responseEnums.getMessage(),null);
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
